<template>
  <div class="page">
    <div class="wrap">
      <div class="header">
        <div class="title">Hi，欢迎使用本系统！</div>
        <div class="desc">首次使用，请先添加大模型</div>
      </div>
      <div class="main">
        <div class="form">
          <LLMForm ref="formRef" from="llm_init">
            <el-form-item>
              <el-button type="primary" @click="onSubmit">添加大模型</el-button>
              <!-- <el-button type="primary" @click="onSkip">跳过(测试)</el-button> -->
            </el-form-item>
          </LLMForm>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import http from '@/utils/http'
import LLMForm from '@/components/llm/LLMForm.vue'

const router = useRouter()

const formRef = ref()

http({
  method: 'post',
  url: '/hids/llm/config/list',
  data: {
    pagenum: 0,
    pagesize: 100,
  },
}).then(res => {
  if (res && res.length) {
    router.replace('/')
  }
})

const onSubmit = () => {
  formRef.value.submit(() => {
    router.replace('/')
  })
}
</script>

<style lang="scss" scoped>
.page {
  background-color: #f8f8f8;
  min-height: 100vh;
  padding-top: 50px;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  background: #fff;
}

.header {
  // background-color: #257fff;
  // background-image: linear-gradient(to right, #257fff, #2b87ff);
  // background-image: linear-gradient(to right, $primary, rgba($primary, 0.4));
  background-image: linear-gradient(to right, #257fff, rgba(#257fff, 0.4));

  padding: 30px;
  color: #fff;
  margin-top: 50px;

  .title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 12px;
  }

  .desc {
    font-size: 16px;
  }
}

.main {
  padding: 30px;

  .form {
    max-width: 570px;
    margin: 0 auto;
  }
}
</style>
